# -*- coding:utf-8


from  typing import List
class Solution:
    def stringMatching(self, words: List[str]) -> List[str]:
        print(words)
        nnn = sorted(words,key= lambda x:x.__len__())
        # print(newLis)
        print(nnn)
        res = []
        for i in range(words.__len__()):
            w = nnn[i]
            for j in range(i+1,words.__len__()):
                if w in nnn[j]:
                    res.append(w)
                if nnn[j] in w:
                    res.append(nnn[j])

        return list(set(res))
res =Solution().stringMatching(["mass","as","hero","superhero"])
print(res)
print("ab" in "aa")
print("aa".__len__())